package il.technion.ewolf.beehive.op;

import il.technion.ewolf.kbr.Key;
import il.technion.ewolf.kbr.Node;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;

/**
 * Base class for all the find value operations
 * @author Ligal ligal2@gmail.com
 * @author Hen senderhen@gmail.com
 */
public abstract class MyFindValueOperation {

	protected Key key;
	protected boolean replication;
	private Collection<Node> bootstrap;
	
	protected MyFindValueOperation() {
		bootstrap = Collections.emptySet();
	}
	
	public MyFindValueOperation setKey(Key key) {
		this.key = key;
		return this;
	}
	
	public MyFindValueOperation setBootstrap(Collection<Node> bootstrap) {
		this.bootstrap = bootstrap;
		return this;
	}
	
	public MyFindValueOperation setReplication(boolean rep) {
		this.replication = rep;
		return this;
	}
	
	protected Collection<Node> getBootstrap() {
		return bootstrap;
	}
	
	public abstract int getNrQueried();
	
	public abstract Serializable doFindValue();
	
}
